package come.example.pagetransformer.transform

import android.support.v4.view.ViewPager
import android.util.Log
import android.view.View

class RotateDownTransformer : ViewPager.PageTransformer {

    override fun transformPage(view: View, position: Float) {
        var pos = position
        val rotation = ROT_MOD * pos * -1.25f

        view.pivotX = view.width * 0.5f
        view.pivotY = view.height *1.0f
        view.rotation = rotation
        Log.d(TAG, "<<< position = $position, pos = $pos, rotation $rotation")

    }

    companion object {
        private val TAG = RotateDownTransformer::class.java.simpleName
        private const val ROT_MOD = -15f
    }
}
